﻿@using Website.CRUDServices
@using Location = Website.Models.Domain.Location
@{
    this.ViewBag.Title = "Søgning - Projekter";
    this.Layout = "~/Views/_Shared/_Layout.cshtml";
    List<Project> projects = this.ViewData["Projects"] as List<Project> ?? new List<Project>();
    List<Location> locations = this.ViewData["Locations"] as List<Location> ?? new List<Location>();
    List<ProjectType> types = this.ViewData["ProjectMeetingTypes"] as List<ProjectType> ?? new List<ProjectType>();
    List<ProjectMeetingDemonstration> demonstrations = this.ViewData["ProjectMeetingDemonstrations"] as List<ProjectMeetingDemonstration> ?? new List<ProjectMeetingDemonstration>();
    List<ProjectMeetingRole> roles = this.ViewData["ProjectMeetingRoles"] as List<ProjectMeetingRole> ?? new List<ProjectMeetingRole>();
}

<h2>@ViewBag.Title</h2>

@using (this.Html.BeginForm("ProjectsSearchResult", "Reports"))
{
@* Tilføjer søge-partial *@
    @Html.Partial("~/Views/Reports/_SearchDefaultFields.cshtml", projects)

    <div class="formBullet">Lokation:</div>
    <div class="formEntry">
        <select name="Location" id="Location">
            <option value="@Guid.Empty.ToString()" selected="selected"></option>
            @foreach (Location loc in locations)
            {
                <option value="@loc.ID">@loc.Name</option>
            }
        </select>
    </div>
    
    <div class="formBullet">Projekttype:</div>
    <div class="formEntry">
        <select name="ProjectType" id="ProjectType">
            <option value="@Guid.Empty.ToString()" selected="selected"></option>
            @foreach (ProjectType pt in types.OrderBy(x => x.IsResearchAndDevelopment).ThenBy(x => x.Name))
            {
                <option value="@pt.ID">@Html.Raw(string.Format("({0}) {1}", pt.IsResearchAndDevelopment ? "R&D" : "Ikke R&D", pt.Name))</option>
            }
        </select>
    </div>
    
    
    <div class="formBullet">Hvad var udført:</div>
    <div class="formEntry">
        <select name="Demonstration" id="Demonstration">
            <option value="@Guid.Empty.ToString()" selected="selected"></option>
            @foreach (ProjectMeetingDemonstration pd in demonstrations)
            {
                <option value="@pd.ID">@pd.Name</option>
            }
        </select>
    </div>
    
    <div class="formBullet">WT rolle:</div>
    <div class="formEntry">
        <select name="Role" id="Role">
            <option value="@Guid.Empty.ToString()" selected="selected"></option>
            @foreach (ProjectMeetingRole pr in roles)
            {
                <option value="@pr.ID">@pr.Name</option>
            }
        </select>
    </div>
    
    <div class="formBullet">Status på projekt:</div>
    <div class="formEntry">
        <table style="width: 50%; text-align: center;">
            <tr>
                <td>
                    <label>
                        <input type="radio" name="StatusType" value="@ProjectMeetingStatusType.None" checked="checked"/><br />
                        Alle</label></td>
                <td>
                    <label>
                        <input type="radio" name="StatusType" value="@ProjectMeetingStatusType.NotStarted" /><br />
                        Ikke startet</label></td>
                <td>
                    <label>
                        <input type="radio" name="StatusType" value="@ProjectMeetingStatusType.Started" /><br />
                        Startet</label></td>
                <td>
                    <label>
                        <input type="radio" name="StatusType" value="@ProjectMeetingStatusType.Completed" /><br />
                        Færdigt</label></td>
            </tr>
        </table>
    </div>
    
    
    <div class="buttonHolder">
        <input type="submit" value="Søg" />
    </div>
}
